'use strict'


//连接数据库
const Sequelize = require('sequelize');

//npm install sequelize;数据库
//npm install tedious; 连接数据库


//连接数据库
const sequelize = new Sequelize('mysql','sa','123456',{
    host:'localhost',//本地服务器
    dialect:'mssql' //数据库名称
    // dialectOptions: {
    //     socketPath: '/tmp/mysql.sock' // 指定套接字文件路径
    //     }
});

sequelize
    .authenticate()
    .then(()=>{
        console.log('Connection has been estalished successfully');
    })
    .catch(err=>{
        console.log('Unable to connect to the database:',err);
    });



    //暴露函数
module.exports =sequelize;
